package p1;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/s1")
public class ServletUne extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public ServletUne() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("ServletUne.doGet()");
		String prenom = "pascal";
		String nom = request.getParameter("nom");
		request.setAttribute("prenom", prenom);
		request.setAttribute("nom", nom);
		request.getRequestDispatcher("p1.jsp").forward(request, response);
		System.out.println("********************");
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("ServletUne.doPost()");
		String prenom = "serge";
		String nom = request.getParameter("nom");
		request.setAttribute("prenom", prenom);
		request.setAttribute("nom", nom);
		request.getRequestDispatcher("p1.jsp").forward(request, response);
		System.out.println("********************");
	}
}
